﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPIWareMVVM.ViewModels;
using DataAccess;

namespace SPIWareMVVM.Views.Commands
{
    public class CompleteWOCommand : BaseCommand
    {
        public CompleteWOCommand(BaseViewModel sender)
            : base(sender)
        {
            _sender = (ApplicationViewModel)sender;
        }

        public override void Execute(object parameter)
        {
            WorkOrderList list = null;
            if (parameter != null) list = (WorkOrderList)parameter;

            if (list != null)
            {
                WorkOrder order = (WorkOrder)list.lbWorkOrders.SelectedItem;
                if (order != null) order.WorkOrderCompleted = !order.WorkOrderCompleted;
            }
        }
    }
}
